import {
  Route, Link, Redirect
} from 'react-router-dom';
import List from './list.component'
import DetailForm from './detail.component'
import RoleListForm from './role_list.component'
import UserList from './userlist.component'
import UserDetail from './userdetail.component'
import BaseSettingDetail from './basesetting_detail.component'


class AdminComponent extends React.Component {
  constructor(props) {
    super(props)
  }

  render() {
    let {match, operate} = this.props
    return (
      <div>
        <Route exact path={`${match.url}`} render={() => {
          return <Redirect to={`${match.url}/index`}/>
        }}/>
          <Route exact path='/admin/userlist/index' component={(props) => <UserList {...props}/> }/>
          <Route exact path='/admin/userlist/index/detail/:id' component={(props) => <UserDetail {...props}/> }/>
        <Route exact path='/admin/user/index' component={(props) => <List {...props}/> }/>
        <Route path={`${match.url}/index/add`} component={(props) => <DetailForm operate={operate} {...props}/> }/>
        <Route exact path={`${match.url}/index/edit/:id`}
               component={(props) => <DetailForm operate={operate} {...props}/> }/>
        <Route path={`${match.url}/index/edit/:id/:type`}
               component={(props) => <DetailForm operate={operate} {...props}/> }/>
          <Route exact path='/admin/role/index' component={(props) => <RoleListForm {...props}/> }/>
          <Route exact path='/admin/basesetting/index' component={(props) => <BaseSettingDetail {...props}/> }/>
      </div>
  )
  }
}

export default AdminComponent